********************************************************
*													   *
*			1_mechanisms_cotton_building_layout_app.do *
*													   *
********************************************************

/*  ================================  NOTES  ================================

+ PURPSOSE:
	
	In this do-file we use create Table A.8 showing evidence for the mechanism

	
+ Inputs: 

		* cotton_building_layout.dta
		

		


==============================  TOP MATTER ==============================*/

	*set paths
	global proc_data "`pdir'/data"
	global output "`pdir'/outputs/appendix"

********************************** END HEADER **********************************


use "$proc_data/cotton_building_layout.dta", clear


***************************************************************************************************
************************************	TABLES	 	***********************************************
***************************************************************************************************

************	Table A.8. Mechanism: squarness and density floors 	***********

estimates clear
quietly{
/*1*/eststo: reg survival_1840 floors floors_sq, r
/*2*/eststo: reg survival_1840 squareness squareness_sq, r

}
estout using "$output/Tables/Table_A8.tex", replace label drop(_cons) order($show ) ///
prefoot("\hline") stats(r2 N, layout(@ "\multicolumn{1}{c}{@}") fmt(2 %9.0g) labels("R$^2$" "N")) ///
	mlabels(, title prefix(%) begin(%)) postfoot("\addlinespace[0.1cm] ") end("\\[-0.15cm]") varlabels(, end("\addlinespace[0.2cm] ")) ///
	cells(b(fmt(3) star) se(fmt(3) par)) starlevels($^{*}$ 0.1 $^{**}$ 0.05 $^{***}$ 0.01) style(tex) collabels(none) 			

	*Predicted optimal in the last column added by hand after the table is generated. It is computed as x*=b/2a, where the estimated quadratic equation is ax^2-bx+c. For example, for floors, x*=0.154/(2*0.021)
	
